
class MySingleton

  @@instance ||= {}

  def self.instance
    @@instance[self] ||= initialize_singleton
  end

  def self.reset
    @@instance[self] = reset_singleton
  end

  def self.reset_singleton
    initialize_singleton
  end

  def self.initialize_singleton
    new
  end

  class Test < FwTest
    def test_instance_returns_the_same_instance
      assert_equal MySingleton.instance.class, MySingleton
      assert_equal MySingleton.instance, MySingleton.instance
    end
  end
end
